package com.finance.system.controller;

import com.finance.base.constant.BaseConstants;
import com.finance.framework.controller.BaseController;
import com.finance.framework.controller.Result;
import com.finance.framework.lang.Page;
import com.finance.framework.lang.PageResultBO;
import com.finance.report.bean.pojo.LogisticsExtend;
import com.finance.report.bean.pojo.LogisticsExtendsList;
import com.finance.report.request.LogisticsExtendListReq;
import com.finance.report.service.ILogisticsExtendService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;

/**
 * 运单扩展表数据管理
 */
@Controller
@RequestMapping("/system/extend")
public class LogisticsExtendController extends BaseController{

    @Resource
    private ILogisticsExtendService logisticsExtendService;

    @RequestMapping("/index.htm")
    public String index(){
        return "system/extend/index";
    }

    @RequestMapping("/list")
    public Result list(LogisticsExtendListReq form){
        Page page = Page.getInstance(form);
        LogisticsExtendsList list = new LogisticsExtendsList();
        list.setBusinessCode(form.getBusinessCode());
        list.setWaybillNum(form.getWaybillNum());
        list.setFeeCommitted(form.getFeeCommitted());
        list.setMajor(form.getMajor());
        String tableName= BaseConstants.SYSCONFIG_KEY_LOGISTICS_EXTEND_TABLE + form.getSalaryMonth().trim().replace("-","").substring(2,6);
        list.setTableName(tableName);
        page.setParams(list);
        PageResultBO<LogisticsExtend> resultBO = logisticsExtendService.extendsInfos(page);
        return getSuccessResult(resultBO);
    }
}
